package models

// DomainSummary represents basic domain information
type DomainSummary struct {
	Name   string `json:"name"`
	UUID   string `json:"uuid"`
	State  string `json:"state"`
	Active bool   `json:"active"`
	Memory uint64 `json:"memory"` // KiB
	VCPUs  uint   `json:"vcpus"`
}

// DomainDetail represents detailed domain information
type DomainDetail struct {
	Name      string `json:"name"`
	UUID      string `json:"uuid"`
	State     string `json:"state"`
	Memory    uint64 `json:"memory"`     // Current memory in KiB
	MaxMemory uint64 `json:"max_memory"` // Max memory in KiB
	VCPUs     uint   `json:"vcpus"`
	CPUTime   uint64 `json:"cpu_time"` // CPU time in nanoseconds
	XMLConfig string `json:"xml_config,omitempty"`
}

// CreateDomainRequest represents a request to create a new domain
type CreateDomainRequest struct {
	Name         string `json:"name" binding:"required"`
	UUID         string `json:"uuid"`
	Memory       uint   `json:"memory"` // Memory in MiB
	VCPUs        uint   `json:"vcpus"`
	Architecture string `json:"architecture"` // x86_64, aarch64
	BootMode     string `json:"boot_mode"`    // bios, uefi
	DiskPath     string `json:"disk_path" binding:"required"`
	DiskSize     uint64 `json:"disk_size"`    // Disk size in GiB
	DiskBus      string `json:"disk_bus"`     // virtio, sata, scsi
	NetworkMode  string `json:"network_mode"` // network, bridge, user
	NetworkName  string `json:"network_name"` // Network name
	OSVariant    string `json:"os_variant"`   // OS variant for libosinfo
	AutoStart    bool   `json:"auto_start"`   // Start domain after creation
	SecureBoot   bool   `json:"secure_boot"`  // Enable UEFI Secure Boot

	// CDROM configuration
	CDROMPath string `json:"cdrom_path"` // Path to CDROM ISO image
	CDROMBus  string `json:"cdrom_bus"`  // Bus for CDROM device (ide, sata, scsi)
	CDROMBoot bool   `json:"cdrom_boot"` // Boot from CDROM
}

// NetworkSummary represents basic network information
type NetworkSummary struct {
	Name   string `json:"name"`
	UUID   string `json:"uuid"`
	Active bool   `json:"active"`
	Bridge string `json:"bridge"`
}

// NetworkDetail represents detailed network information
type NetworkDetail struct {
	Name      string `json:"name"`
	UUID      string `json:"uuid"`
	Active    bool   `json:"active"`
	Bridge    string `json:"bridge"`
	XMLConfig string `json:"xml_config,omitempty"`
}

// StoragePoolSummary represents basic storage pool information
type StoragePoolSummary struct {
	Name   string `json:"name"`
	UUID   string `json:"uuid"`
	Active bool   `json:"active"`
	Type   string `json:"type"`
}

// StoragePoolDetail represents detailed storage pool information
type StoragePoolDetail struct {
	Name       string `json:"name"`
	UUID       string `json:"uuid"`
	Active     bool   `json:"active"`
	Type       string `json:"type"`
	Capacity   uint64 `json:"capacity"`
	Allocation uint64 `json:"allocation"`
	Available  uint64 `json:"available"`
	XMLConfig  string `json:"xml_config,omitempty"`
}

// StorageVolumeSummary represents basic storage volume information
type StorageVolumeSummary struct {
	Name string `json:"name"`
	Path string `json:"path"`
	Type string `json:"type"`
}

// StorageVolumeDetail represents detailed storage volume information
type StorageVolumeDetail struct {
	Name       string `json:"name"`
	Path       string `json:"path"`
	Type       string `json:"type"`
	Capacity   uint64 `json:"capacity"`
	Allocation uint64 `json:"allocation"`
	XMLConfig  string `json:"xml_config,omitempty"`
}

// CreateVolumeRequest represents a request to create a storage volume
type CreateVolumeRequest struct {
	Name     string `json:"name" binding:"required"`
	Capacity uint64 `json:"capacity" binding:"required"` // Capacity in bytes
	Format   string `json:"format"`                      // qcow2, raw, etc.
}

// SystemInfo represents hypervisor system information
type SystemInfo struct {
	Hostname          string `json:"hostname"`
	LibvirtVersion    uint32 `json:"libvirt_version"`
	HypervisorVersion uint32 `json:"hypervisor_version"`
	URI               string `json:"uri"`
}

// ConnectionDetail represents detailed connection information
type ConnectionDetail struct {
	Name      string `json:"name"`
	URI       string `json:"uri"`
	Connected bool   `json:"connected"`
	IsDefault bool   `json:"is_default"`
	Hostname  string `json:"hostname"`
	Version   uint32 `json:"version"`
}

// CreateConnectionRequest represents a request to create a new connection
type CreateConnectionRequest struct {
	Name         string `json:"name" binding:"required"`
	URI          string `json:"uri" binding:"required"`
	SetAsDefault bool   `json:"set_as_default"`
}

// TestConnectionRequest represents a request to test a connection
type TestConnectionRequest struct {
	URI string `json:"uri" binding:"required"`
}
